/**
 * 写报告
 */
// 格式化时间yyyy-mm-d
function FormatDate(date) {
	var y = date.getFullYear();
	var m = date.getMonth() + 1;
	var d = date.getDate();
	return y + "-" + m + "-" + d;
}
/**
 * 切换报告
 * @param type
 * @param time
 * @returns
 */
function select(type, time) {
	$('.reports-input .contents').val('');
	$('.summary').val('');
	$('.next-content').val('');
	var index = layer.load(2, {
		  shade: [0.1,'#fff'] 
	});
	$.post('/work/report/select', {
		type : type,
		time : time
	}, function(data) {
		$('.reports-input .contents').val(data.content);
		$('.summary').val(data.summary);
		$('.next-content').val(data.nextContent);
		if (data.id == null) {
			$(".fa a").attr('data-id', '');
			$(".fa a").attr('data-release', '');
		} else {
			$(".fa a").attr('data-id', data.id);
			$(".fa a").attr('data-release', data.release);

		}
		$('.evaluate').css({
			display : 'none'
		})
		$(".fa a").css({
			display : 'none'
		})
		$('.head-box div').css({
				display : 'none'
			})
		if (data.release == 0) {
			$('.head-box div').css({
				display : 'inline-block'
			})
			$(".fa a").css({
			display : 'block'
		})
		} else if (data.release == 1) {
			$('.evaluate-fa a').attr('data-id', data.id)
			$('.evaluate').css({
				display : 'block'
			})
			evaluate(data.id);
		}
		layer.close(index);
	})
}
/**
 * 切换报告时变更评价
 * @param id
 * @returns
 */
function evaluate(id) {
	var index = layer.load(2, {
		  shade: [0.1,'#fff'] 
	});
	$.post('/work/report/select/evaluate', {
		id : id
	}, function(data) {
		$('.evaluates').remove();
		$.each(data, function(n, e) {
			ping(e)
		});
		layer.close(index);
	})
}
/**
 * 插入一条评价
 * @param e
 * @returns
 */
function ping(e) {
	var div1 = $('<div>').attr('class', 'evaluates');
	var div2 = $('<div>').attr('class', 'tou');
	var span1 = $('<span>').text(e.user.realName);
	var span3 = $('<span>').text(" 回复:")
	$(span3).css({
		'font-size' : '12px'
	});
	$(div1).append($(div2).append(span1).append(span3));
	var div3 = $('<div>').attr('class', 'information');
	var div4 = $('<div>').attr('class', 'cont');
	var p = $('<p>').text(e.content);
	$(div3).append($(div4).append(p));
	var div5 = $('<div>').attr('class', 'evaluate-time');
	var span2 = $('<span>').text(e.time);
	$(div3).append($(div5).append(span2));
	$(div1).append(div3);
	$('.evaluate').append(div1);
}

$(function() {
	// 参数为0代表本年
	function retimetree(year) {
		if (year == null) {
			var nows = new Date();
		} else {
			var nows = new Date(year, 1, 1);
		}
		var years = nows.getFullYear();
		var nows2 = new Date(years, 0, 2);
		nows2 = getWeek(7, nows2);
		nows2.setDate(nows2.getDate() + 1);
		// var ew=0;
		for (var q = 1; q < 13; q++) {
			// 获取要插入的月份div
			var div2 = rD(q);
			var ul1 = $('<ul>').attr('class', 'timetree-weeklist');
			var ds = new Date(years, q, 0).getDate();
			for (var a = 1; a < 6; a++) {
				var as;
				if (a == 1) {
					as = 1;
				} else {
					as = 1 + (a - 1) * 7;
				}
				if (as >= ds) {
					as = ds;
				}
				// console.log(years,q-1,as);
				var yu = new Date(years, q - 1, as);
				// 判断跨月的周是属于哪一周
				if (as == 1 && q != 1) {
					var ed = getWeek(7, yu);
					if ((ed - yu) / (24 * 60 * 60 * 1000) < 3) {
						continue;
					}
				} else if (as == ds) {
					var sd = getWeek(1, yu);
					if ((yu - sd) / (24 * 60 * 60 * 1000) < 4) {
						continue;
					}
				}
				var rq = yu - nows2;
				var s1 = Math.ceil(rq / (24 * 60 * 60 * 1000));
				var s2 = Math.ceil(s1 / 7) + 1;
				if (s2 == 0) {
					continue;
				}
				var a1 = $('<a>').text('第' + s2 + '周');
				$(a1).attr('tswk', FormatDate(getWeek(7, yu)));
				var em8 = $('<em>').attr('class', 'arrow-s');
				var em9 = $('<em>').attr('class', 'arrow-b');
				$(a1).attr('class', 'router');
				$(a1).attr('week', s2);
				$(a1).append(em8).append(em9);
				var em2 = $('<em>');
				$(em2).attr('class', 'time-circle');
				$(em2).attr('week', s2);
				var li1 = $('<li>').attr('class', 'j_week');
				$(li1).append(em2).append(a1);
				$(ul1).append(li1);
			}
			$(div2).append(ul1);
			$('.m_container .reports-timetree').append(div2);
			if ((q / 3) == 1) {
				cDivs('第一季度', '1');
			} else if ((q / 3) == 2) {
				cDivs('年中', '2').addClass('zhong');
			} else if ((q / 3) == 3) {
				cDivs('第三季度', '3');
			} else if ((q / 3) == 4) {
				cDivs('2017年度', '4').addClass('lee');
			}
		}
	}
	;
	// 初始化时间轴
	retimetree();

	// 返回要插入的月份div
	function rD(q) {
		var label1 = $('<label>').text(q + '月');
		var span1 = $('<span>').attr('class', 'time-text');
		$(span1).attr('month', q);
		$(span1).append(label1);
		var em1 = $('<em>').attr('class', 'time-circle');
		$(em1).attr('month', q);
		var span2 = $('<span>').attr('class', 'j_timetree_spread').append(em1);
		var div1 = $('<div>').attr('class', 'timetree-head');
		$(div1).append(span1).append(span2);
		var div2 = $('<div>').attr('class', 'timetree-month');
		$(div2).append(div1);
		return div2;
	}
	// 插入季度div
	function cDivs(a, n) {
		var span3 = $("<span>").text(a).attr('class', 'time-text');
		$(span3).attr('season', n);
		var em3 = $('<em>').attr('class', 'time-circle');
		var span4 = $('<span>').attr('class', 'j_timetree_spread').append(em3);
		var div4 = $('<div>').attr('class', 'timetree-head');
		$(div4).addClass('season');
		$(div4).append(span3).append(span4);
		$('.m_container .reports-timetree').append(div4);
		return div4;
	}
	// n=1获取本周开始时间
	function getWeek(n, a) {
		if (a == null) {
			a = new Date();
		}
		var now = a;
		var year = now.getFullYear();
		// 因为月份是从0开始的,所以获取这个月的月份数要加1
		var month = now.getMonth() + 1;
		var date = now.getDate();
		var day = now.getDay();
		// console.log("今天是" + year + "-" + month + "-" + date + "*" + day);
		// 判断是否为周日
		if (day !== 0) {
			n = n - day;
		} else {
			n = n - 7;
		}
		var d = new Date(year, month, 0).getDate();
		// 解决跨月跨年
		date = date + n;
		for (var int = 1; int > 0; int++) {
			var d = new Date(year, month, 0).getDate();
			if (date > d) {
				date = date - d;
				month = month + 1;
				if (month > 12) {
					year = year + 1;
					month = 1;
				}
			} else if (date <= 0) {
				month = month - 1;
				if (month == 0) {
					year = year - 1;
					month = 12;
				}
				var d = new Date(year, month, 0).getDate();
				date = date + d;
			} else {
				break;
			}
		}
		s = year + "-" + month + "-" + date;
		// console.log(s);
		return new Date(s);
	}

	// 鼠标停留变蓝
	// 上下周
	$('.time-text').on('mouseover', function() {
		$(this).addClass('color');
	})
	$('.time-text').on('mouseleave', function() {
		$(this).removeClass('color');
	});
	$('.router').on('mouseover', function() {
		$(this).addClass('color');
	})
	$('.router').on('mouseleave', function() {
		$(this).removeClass('color');
	});
	// 点击时清除原有class样式
	function remveC() {
		$('.m_container .texcolor').removeClass('texcolor');
		$('.m_container .emcolor').removeClass('emcolor');
		$('.m_container .weekem').removeClass('weekem');
		$('.m_container .case').removeClass('case');
	}

	// 点击月选择
	$('.presentation-left')
			.on(
					'click',
					' .time-text',
					function() {
						ymonth();
						var ne = new Date();
						if ($(this).attr('class') == 'time-text texcolor') {
							return;
						}
						remveC();
						$(this).addClass('texcolor');
						$(this).siblings('.j_timetree_spread').addClass(
								'emcolor');
						var content = $(this).parent('.timetree-head')
								.siblings('.timetree-weeklist');
						if ($(this).parent('.timetree-head').siblings('ul')
								.attr('class') == 'timetree-weeklist xian') {
							tsmonth($(this).attr('month'));
							return;
						}
						$('.m_container .xian').removeClass('xian')
								.slideUp(300);
						$(content).css({
							overflow : "visible"
						})
						content.fadeIn(300, function() {
							content.addClass('xian');
						})
						$('.head-box').attr('time', $(this).attr('month'));
						if ($(this).parent().attr('class') == 'timetree-head season') {
							if (((ne.getMonth() + 1) / 4 + 1) >= $(this).attr(
									"season")) {
								bian()
								yall();
								$('.head-box span').text(
										$(this).text() + "工作报告");
								$('.reports-input-tit .task').text('本季度工作成效');
								$('.reports-input-tit .jihuamingming').text(
										'下季度计划内容');
								$('.head-box span').attr('data-type', 'season');
								$('.head-box').attr('time',
										$(this).attr('season'))
								select('season', $(this).attr('season'))
							} else {
								nobian();
								yall();
								$('.head-box span').text(
										$(this).text() + "工作报告");
								$('.reports-input-tit .task').text('本季度工作成效');
								$('.reports-input-tit .jihuamingming').text(
										'下季度计划内容');
								$('.head-box span').attr('data-type', 'season');
							}

						} else if ($(this).parent().attr('class') == 'timetree-head season lee') {
							if ((ne.getMonth() + 1) == 12) {
								bian();
							} else {
								nobian();
							}
							yall();
							$('.head-box span').text($(this).text() + "工作报告");
							$('.reports-input-tit .task').text('本年工作成效');
							$('.reports-input-tit .jihuamingming').text(
									'明年计划内容');
							$('.head-box span').attr('data-type', 'year');
							$('.head-box').attr('time', $(this).attr('season'));
							select('year', $(this).attr('season'));
						} else if ($(this).parent().attr('class') == 'timetree-head season zhong') {
							if ((ne.getMonth() + 1) >= 6) {
								bian();
							} else {
								nobian();
							}
							yall();
							$('.head-box span').text($(this).text() + "工作报告");
							$('.reports-input-tit .task').text('上半年工作成效');
							$('.reports-input-tit .jihuamingming').text(
									'下半年计划内容');
							$('.head-box span').attr('data-type', 'year');
							$('.head-box').attr('time', $(this).attr('season'));
							select('year', $(this).attr('season'));
						} else {
							tsmonth($(this).attr('month'));
						}
					})
	$('.timetree-head .time-circle').on('click', function() {
		$(this).parent('.j_timetree_spread').siblings('.time-text').click();
	})
	// 锁定为不可编辑
	function nobian() {
		$('.form-control-no').css({
			display : "block"
		})
		$('.form-control').css({
			display : "none"
		})
		$('.fa').css({
			display : "none"
		})
	}
	// 变为可编辑
	function bian() {
		$('.form-control-no').css({
			display : "none"
		})
		$('.form-control').css({
			display : "block"
		})
		$('.fa').css({
			display : "block"
		})
	}
	// 点击周选择
	$('.router').on(
			'click',
			function() {
				$(this).parents('.timetree-weeklist')
						.siblings('.timetree-head').children('.time-text')
						.click();
				remveC();
				$(this).siblings('em').addClass('weekem');
				$(this).addClass('case');
				$('.head-box').attr('time', $(this).attr('week'))
				var now = new Date($(this).attr('tswk'));
				yweek();
				tswk(now);
			})
	// 切换上下月为上下周
	function yweek() {
		$('.prev-week').css({
			display : 'block'
		})
		$('.current-week').css({
			display : 'block'
		})
		$('.next-week').css({
			display : 'block'
		})
		$('.prev-month').css({
			display : 'none'
		})
		$('.current-month').css({
			display : 'none'
		})
		$('.next-month').css({
			display : 'none'
		})
	}
	// 切换上下周为上下月
	function ymonth() {
		$('.prev-week').css({
			display : 'none'
		})
		$('.current-week').css({
			display : 'none'
		})
		$('.next-week').css({
			display : 'none'
		})
		$('.prev-month').css({
			display : 'block'
		})
		$('.current-month').css({
			display : 'block'
		})
		$('.next-month').css({
			display : 'block'
		})
	}
	// 上下周上下月全部隐藏
	function yall() {
		$('.prev-week').css({
			display : 'none'
		})
		$('.current-week').css({
			display : 'none'
		})
		$('.next-week').css({
			display : 'none'
		})
		$('.prev-month').css({
			display : 'none'
		})
		$('.current-month').css({
			display : 'none'
		})
		$('.next-month').css({
			display : 'none'
		})
	}

	$('.j_week .time-circle').on('click', function() {
		$(this).siblings('.router').click();
	})

	// 点击本月
	function tsmonth(month) {
		now = new Date();
		if (month != null) {
			now.setMonth(month - 1);
			var pan = 1;
		} else {
			var pan = null;
		}
		var tm = $('.m_container .time-text');
		var m = now.getMonth() + 1;
		$.each(tm, function(index, domEl) {
			if ($(domEl).attr('month') == m) {
				if (((new Date()).getMonth() + 1) >= m) {
					bian();
					$('.head-box span').text(m + "月工作报告");
					$('.reports-input-tit .task').text('本月工作成效');
					$('.reports-input-tit .jihuamingming').text('下月计划内容');
					$('.head-box span').attr('data-type', 'month');
					$('.head-box').attr('time', m);
					select('month', m)
				} else {
					nobian();
					$('.head-box span').text(m + "月工作报告");
					$('.reports-input-tit .task').text('本月工作成效');
					$('.reports-input-tit .jihuamingming').text('下月计划内容');
					$('.head-box span').attr('data-type', 'month');
					$('.head-box').attr('time', m);
					select('month', m)
				}

				if (pan == null) {
					$(domEl).click();
					setTimeout(function() {
						gunmonth()
					}, 300);
				}

			}
		});
	}
	// 点击周不传参代表本周
	function tswk(now) {
		if (now == null) {
			now = new Date();
			var pan = null;
		} else {
			var pan = 1;
		}
		var nows4 = new Date(now.getFullYear(), 0, 2);
		nows4 = getWeek(7, nows4);
		nows4.setDate(nows4.getDate() + 1);
		var pw = now - nows4;
		var tian = Math.ceil(pw / (24 * 60 * 60 * 1000));
		var zhou = Math.ceil(tian / 7) + 1;
		var zh = $('.m_container .router');
		$.each(zh, function(index, domEl) {
			if ($(domEl).attr('week') == zhou) {
				var s = FormatDate(getWeek(1, now));
				var ss = FormatDate(getWeek(7, now));

				if (getWeek(1, now) <= (new Date())) {
					bian();
				} else {
					nobian();
				}
				$('.head-box span').text(
						"第" + zhou + "周工作报告（" + s + "~" + ss + ")");
				$('.reports-input-tit .task').text('本周工作成效');
				$('.reports-input-tit .jihuamingming').text('下周计划内容');
				$('.head-box span').attr('data-type', 'week');
				select('week', zhou)
				if (pan == null) {
					$(domEl).click();
					gunweek();
				}
			}
		});
	}
	// 初始化点击当前周
	tswk()
	// 上下周
	$('.pxybtn').on('mouseover', function() {
		$(this).addClass('light');
	})
	$('.pxybtn').on('mouseleave', function() {
		$(this).removeClass('light');
	});
	$('.prev-week').on('click', function() {
		var zh = $('.m_container .router');
		var week = parseInt($('.head-box').attr('time')) - 1;
		$.each(zh, function(index, domEl) {
			if ($(domEl).attr('week') == week) {
				$(domEl).click();
				gunweek();
			}
		})
	})
	$('.next-week').on('click', function() {
		var zh = $('.m_container .router');
		var week = parseInt($('.head-box').attr('time')) + 1;
		$.each(zh, function(index, domEl) {
			if ($(domEl).attr('week') == week) {
				$(domEl).click();
				gunweek();
			}
		})
	})
	$('.current-week').on('click', function() {
		tswk();
	})

	// 上下月
	$('.prev-month').on('click', function() {
		var zh = $('.m_container .time-text');
		var month = parseInt($('.head-box').attr('time')) - 1;
		$.each(zh, function(index, domEl) {
			if ($(domEl).attr('month') == month) {
				$(domEl).click();
				gunmonth()
			}
		})
	})
	$('.next-month').on('click', function() {
		var zh = $('.m_container .time-text');
		var month = parseInt($('.head-box').attr('time')) + 1;
		$.each(zh, function(index, domEl) {
			if ($(domEl).attr('month') == month) {
				$(domEl).click();
				setTimeout(function() {
					gunmonth()
				}, 400);
			}
		})
	})
	$('.current-month').on('click', function() {
		tsmonth();
	})
	// 选周时定位滑动条
	function gunweek() {
		var wai = $('.m_container').offset();
		var scrollto = $('.case').offset();
		var container = $('.mCustomScrollBox').scrollTop(
				scrollto.top - wai.top - 20);

	}
	// 选月时定位滑动条
	function gunmonth() {
		var wai = $('.m_container').offset();
		var scrollto = $('.texcolor').offset();
		$('.mCustomScrollBox').animate({
			scrollTop : scrollto.top - wai.top - 30
		}, 500);
	}

	$('.form-control').on('change', function() {
		var data = seav($('.fa a').attr('data-release'));
		layer.msg("修改成功！", {
			time : 1000
		});
	})
	// 发布报告
	$('.fa').on('click', 'a', function() {
		$('.form-control')
		if ($(this).attr('data-release') == 1) {
			return;
		}
		var data = seav(1);
		layer.msg("发布成功！", {
			time : 1000
		});
	})
	function seav(release) {
		var type = $('.head-box span').attr('data-type');
		var year = $('.dropdown span').text();
		var time = $('.head-box').attr('time');
		var content = $('.reports-input .contents').val();
		var summary = $('.summary').val();
		var nextContent = $('.next-content').val();
		var id = $('.fa a').attr('data-id');
		$.post('/work/report/seav', {
			id : id,
			type : type,
			year : year,
			time : time,
			content : content,
			summary : summary,
			nextContent : nextContent,
			release : release
		}, function(data) {
			if (data.release == 0) {
				$('.head-box div').css({
					display : 'inline-block'
				})
			} else {
				$('.head-box div').css({
					display : 'none'
				})
			}
			$(".fa a").attr('data-id', data.id);
		})
	}
	$('.presentation-right').on('click', '.evaluate-fa a', function() {
		var content = $('.evaluate-text .con').val();
		$('.evaluate-text .con').val('');
		var id = $(this).attr('data-id');
		$.post('/work/report/save/evaluate', {
			content : content,
			wsId : id
		}, function(data) {
			if (data != null) {
				layer.msg("发表成功！", {
					time : 1000
				});
				ping(data);
			}
		})
	})
});
/* 查阅报告 */
$(function() {
	$('.pxybtn').on('mouseover', function() {
		$(this).addClass('light');
	})
	$('.pxybtn').on('mouseleave', function() {
		$(this).removeClass('light');
	});
	$('.pxybtn').on('click', function() {
		$('.att').removeClass('att');
		$(this).addClass('att');
		$('.control-label').attr('data-type', $(this).attr('data-type'));
	})

	function ptype() {
		var type = $('.control-label').attr('data-type');
		$.each($('.date .pxybtn'), function(n, p) {
			$(p).attr('class', 'pxybtn');
			$(p).attr('data-type');
			if (type != null && type == $(p).attr('data-type')) {
				$(p).addClass('att');
			}
		})
	}
	ptype()
	$('.remind-toggle').on('click', function() {

	})
	$('.content-wrapper')
			.on(
					'click',
					function(event) {
						if ($(event.target).text()=="取消") {
							$('.remind-psb').css({
								display : "none"
							})
						}
						if ($(event.target).parents('.remind-psb').length) {
							console.log('iconfont icon-chuyidong')
						} else if ($(event.target).attr('class') == 'iconfont icon-chuyidong') {
						} else if ($(event.target).attr('class') == 'remind-psb') {
						} else if ($(event.target).attr('class') == 'remind-toggle') {
							var s = $(event.target).parents("th").index();
							var va = $(event.target).text();
							var y = $('.ye span').text();
							$('.remind-psb').css({
								display : "block"
							});
							$('.workreport span').remove();
							$.each($('.check-table tr'),
									function(index, domEl) {
										var name = $(domEl).children('td')
												.eq(s).children('.wu').attr(
														'data-name');
										var span = $('<span>').text(name);
										$(span).attr('class', 'add-name');
										var i = $('<i>').attr('class',
												'iconfont icon-chuyidong');
										$(span).attr(
												'data-uid',
												$(domEl).children('td').eq(s)
														.children('.wu').attr(
																'data-uid'))
										$(span).append(i);
										$('.workreport').append(span);

									})
							$('.remind-psb .form-control').text(
									'请提交' + y + '年' + va + '的报告！')
						} else if ($(event.target).attr('class') == 'img wu') {
							var s = $(event.target).parents("td").index();
							var va = $('.check-table tr:eq(0) th:eq(' + s + ')')
									.text();
							var y = $('.ye span').text();
							$('.remind-psb').css({
								display : "block"
							});
							$('.workreport span').remove();
							var name = $(event.target).attr('data-name');
							var span = $('<span>').text(name);
							var i = $('<i>').attr('class',
									'iconfont icon-chuyidong');
							$(span).attr('class', 'add-name');
							$(span).attr('data-uid',
									$(event.target).attr('data-uid'));
							$(span).append(i);
							$('.workreport').append(span);
							$('.remind-psb .form-control').text(
									'请提交' + y + '年' + va + '的报告！')
						} else {
							$('.remind-psb').css({
								display : "none"
							})
						}
					})

	$('.consult .toolkit-item').on(
			'click',
			'.pxybtn',
			function() {
				var type = $(this).attr('data-type');
				var year = $('.ye span').text();
				refreshPanel('/work/report/consult?year=' + year + '&type='
						+ type, "查阅报告")
			})
	/**
	 * 遍历有多少报告
	 */
	function tab() {
		$('.check-table')
		// $(this).parents("tr").find("td").index($(this));
		// $("#表格ID td:eq({x})").text();
	}

	$('.icon-feedback_fill').on('mouseover', function() {
		$('.tishi').css({
			display : 'block'
		});
	})
	$('.icon-feedback_fill').on('mouseleave', function() {
		$('.tishi').css({
			display : 'none'
		});
	});

	/**
	 * 点击查看
	 */
	$('.you').on('click', function() {
		var id = $(this).attr('data-rid');
		refreshPanel(getUrlPrefix('/work/report/read?id=' + id), "查看报告")
	})

	$('.readwr').on('click', '.evaluate-fa a', function() {
		var content = $('.evaluate-text .con').val();
		console.log(content);
		var id = $(this).attr('data-id');
		$.post('/work/report/save/evaluate', {
			content : content,
			wsId : id
		}, function(data) {
			if (data != null) {
				layer.msg("发表成功！", {
					time : 1000
				});
				refresh(this);
			}
		})
	})
	
	/**
	 * 报告统计选择类型
	 */
	$('.statistic .toolkit-item').on('click','.pxybtn',
			function() {
				var type = $(this).attr('data-type');
				var year = $('.ye span').text();
				refreshPanel('/work/report/statistics?type='
						+ type, "报告统计")
	})
	
	/**
	 * 模糊查寻
	 */
	$('.consult').on('click','.search-btn',function(){
		var type = $('.att').attr('data-type');
		var year = $('.ye span').text();
		refreshPanel('/work/report/consult?type='+ type+'&key='+$('.key').val()+'&did='+$('.dept option:selected').val(),
				"报告查阅")
	})
	//报告统计模糊查寻
	$('.statistic').on('click','.search-btn',function(){
		var name=$('.name').val();
		refreshPanel('/work/attend/statistics?key='+name+'&type='+$('.date .att').attr('data-type'),
		"报告统计")
	})
	//取消通知人
	$('.workreport').on('click','.icon-chuyidong',function(){
		$(this).parent('.add-name').remove();
	})
	//通知
	$('.remind-psb').on('click','.tix .qd',function(){
		$('.remind-psb').css({
			display : "none"
		})
		var users;
		$.each($('.remind-psb .add-name'), function(n, e) {
			if (n==0) {
				users =$(e).attr('data-uid');
			}else {
				users =users+","+$(e).attr('data-uid');
			}
		});
		
		var con=$('.form-control').val();
		$.post('/work/attend/annusers',{
			users:users,
			con:con
		},function(data){
			if (data) {
				layer.msg("已通知！", {
					time : 1000
				});
			}
		})
		
		console.log(users)
		console.log(con)
	})
	//console.log('waw')
})



